package com.td.module.agro.dal.mysql.inputreview;

import com.td.framework.common.pojo.PageResult;
import com.td.framework.mybatis.core.mapper.BaseMapperX;
import com.td.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.td.module.agro.controller.admin.inputreview.vo.InputReviewExportReqVO;
import com.td.module.agro.controller.admin.inputreview.vo.InputReviewPageReqVO;
import com.td.module.agro.dal.dataobject.inputreview.InputReviewDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 商品与投入品中间 Mapper
 *
 * @author 吴佰强
 */
@Mapper
public interface InputReviewMapper extends BaseMapperX<InputReviewDO> {

    default PageResult<InputReviewDO> selectPage(InputReviewPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InputReviewDO>()
                .eqIfPresent(InputReviewDO::getInputId, reqVO.getInputId())
                .eqIfPresent(InputReviewDO::getReviewId, reqVO.getReviewId())
                .orderByDesc(InputReviewDO::getId));
    }

    default List<InputReviewDO> selectList(InputReviewExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<InputReviewDO>()
                .eqIfPresent(InputReviewDO::getInputId, reqVO.getInputId())
                .eqIfPresent(InputReviewDO::getReviewId, reqVO.getReviewId())
                .orderByDesc(InputReviewDO::getId));
    }

}
